﻿using System.Windows.Controls;
using GPToolkit.Vcard;
using System.IO;

namespace GPToolkit.demo.uc
{
	/// <summary>
	/// Logique d'interaction pour VcardUC.xaml
	/// </summary>
	public partial class VcardUC : UserControl
	{
		public VcardUC() {
			InitializeComponent();
		}

		private void btnGenerate_Click(object sender, System.Windows.RoutedEventArgs e) {
			var generator = new VcardGenerator21(
				this.tbxFirstName.Text,
				this.tbxLastName.Text
			);

			generator.AddOrganization(this.tbxOrganization.Text);
			generator.AddEmailInternet(this.tbxEmail.Text);

			var writer = new StreamWriter("C:\\test.vcf");
			writer.Write(generator.GetVCard());
			writer.Flush();
			writer.Close();
		}
	}
}
